home *** CD-ROM | disk | FTP | other *** search
- (* (* $VER: fLRealIO 1.1 (21-May-94) Copyright © by Lars Düning *) *)
-
- MODULE fLRealIO;
-
- (*---------------------------------------------------------------------------
- ** File-IO of LONGREAL numbers for Amiga-Oberon.
- **
- ** Copyright © 1991-1994 Lars Düning - All rights reserved.
- ** Permission granted for non-commercial use.
- **---------------------------------------------------------------------------
- ** CREDIT:
- ** This module evolved from RealIO of Amiga-Oberon v1.17.1
- **---------------------------------------------------------------------------
- ** Oberon-2: Amiga-Oberon v3.10, F. Siebert / A+L AG
- **---------------------------------------------------------------------------
- ** [lars] Lars Düning; Am Wendenwehr 25; D-38114-Braunschweig;
- ** Germany; Tel. 49-531-345692
- **---------------------------------------------------------------------------
- ** 01-Jan-91 [lars]
- ** 21-May-04 [lars] Moved ParseReal() from fio to fRealIO.
- **---------------------------------------------------------------------------
- *)
-
- IMPORT
- (* $IF Debug *) Debug, (* $END *)
- fio, fRealIO, rc: LongRealConversions;
-
- (*-------------------------------------------------------------------------*)
- PROCEDURE writeReal * {"fLRealIO.WriteReal"}
- ( VAR f : fio.File
- ; r : LONGREAL
- ; v, n : INTEGER
- ; exp : BOOLEAN
- );
- PROCEDURE WriteReal * ( VAR f : fio.File
- ; r : LONGREAL
- ; v, n : INTEGER
- ; exp : BOOLEAN
- ): BOOLEAN;
-
- (* Write a REAL number into a file.
- **
- ** Arguments:
- ** f : the file to write to.
- ** r : the number to write.
- ** v : number of digits in front of the '.'
- ** n : number of digits after the '.'
- ** exp: if TRUE, the 'E' notation is used when appropriate.
- **
- ** Result:
- ** TRUE on success, else FALSE with out.status denoting the error.
- ** If FALSE is returned, but out.status is 'ok', then the number is
- ** larger than the allowed number of digits.
- *)
-
- VAR
- str: ARRAY 256 OF CHAR;
-
- BEGIN
- IF rc.RealToString(r,str,v,n,exp) THEN
- RETURN fio.WriteString(f,str);
- ELSE
- RETURN FALSE;
- END;
- END WriteReal;
-
- (*-------------------------------------------------------------------------*)
- PROCEDURE readReal * {"fLRealIO.ReadReal"}(VAR f : fio.File; VAR r: LONGREAL);
- PROCEDURE ReadReal * (VAR f : fio.File; VAR r: LONGREAL): BOOLEAN;
-
- (* Read a REAL number from a file.
- **
- ** Arguments:
- ** f : the file to read from.
- ** r : variable to take the number read.
- **
- ** Result:
- ** TRUE on success, else FALSE with out.status denoting the error.
- ** If FALSE is returned, but out.status is 'ok', then no correct number
- ** could be read.
- ** r: the number read.
- *)
-
- VAR
- str: ARRAY 256 OF CHAR;
-
- BEGIN
- IF fRealIO.ParseReal(f, str) THEN
- RETURN rc.StringToReal(str,r);
- END;
- RETURN FALSE;
- END ReadReal;
-
- END fLRealIO.
-
- (***************************************************************************)
-